42. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2021-05-13 09:08:39 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

42.1 Files compared

#LocationFileLast Modified
12021-05-13 09:08:39 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/jslayer.js2016-10-19 20:44:28 +0000

42.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted1144
Removed00

42.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

42.4 Active regular expressions

No regular expressions were active.

42.5 Comparison detail

    1 /**
    2  * Copyright ? 2016 Mageplaza. All rights reserved.
    3  * See https://www.mageplaza.com/LICENSE.txt for license details.
    4  */
    5 define([
    6     'jquery',
    7     'jquery/ui',
    8     'productListToolbarForm'
    9 ], function ($) {
    10     "use strict";
    11 
    12     $.widget('mageplaza.layer', {
    13 
    14         options: {
    15             productsListSelector: '#layer-product-list',
    16             navigationSelector: '#layered-filter-block'
    17         },
    18 
    19         _create: function () {
    20             this.initProductListUrl();
    21             this.initObserve();
    22             this.initLoading();
    23         },
    24 
    25         initProductListUrl: function () {
    26             var self = this;
    27             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
    28                 var urlPaths = this.options.url.split('?'),
    29                     baseUrl = urlPaths[0],
    30                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
    31                     paramData = {},
    32                     parameters;
    33                 for (var i = 0; i < urlParams.length; i++) {
    34                     parameters = urlParams[i].split('=');
    35                     paramData[parameters[0]] = parameters[1] !== undefined
    36                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
    37                         : '';
    38                 }
    39                 paramData[paramName] = paramValue;
    40                 if (paramValue == defaultValue) {
    41                     delete paramData[paramName];
    42                 }
    43                 paramData = $.param(paramData);
    44 
    45                 self.ajaxSubmit(baseUrl + (paramData.length ? '?' + paramData : ''));
    46             }
    47         },
    48 
    49         initObserve: function () {
    50             var self = this;
    51             var aElements = this.element.find('a');
    52             aElements.each(function (index) {
    53                 var el = $(this);
    54                 var link = self.checkUrl(el.prop('href'));
    55                 if(!link) return;
    56 
    57                 el.off('click').on('click', function (e) {
    58                     if (el.hasClass('swatch-option-link-layered')) {
    59                         var childEl = el.find('.swatch-option');
    60                         childEl.addClass('selected');
    61                     } else {
    62                         var checkboxEl = el.find('input[type=checkbox]');
    63                         checkboxEl.prop('checked', !checkboxEl.prop('checked'));
    64                     }
    65 
    66                     self.ajaxSubmit(link);
    67                     e.stopPropagation();
    68                     e.preventDefault();
    69                 });
    70 
    71                 var checkbox = el.find('input[type=checkbox]');
    72                 checkbox.off('click').on('click', function (e) {
    73                     self.ajaxSubmit(link);
    74                     e.stopPropagation();
    75                 });
    76             });
    77 
    78             $(".filter-current a").off('click').on('click', function (e) {
    79                 var link = self.checkUrl($(this).prop('href'));
    80                 if(!link) return;
    81 
    82                 self.ajaxSubmit(link);
    83                 e.stopPropagation();
    84                 e.preventDefault();
    85             });
    86 
    87             $(".filter-actions a").off('click').on('click', function (e) {
    88                 var link = self.checkUrl($(this).prop('href'));
    89                 if(!link) return;
    90 
    91                 self.ajaxSubmit(link);
    92                 e.stopPropagation();
    93                 e.preventDefault();
    94             });
    95         },
    96 
    97         checkUrl: function (url) {
    98             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
    99 
    100             return regex.test(url) ? url : null;
    101         },
    102 
    103         initLoading: function () {
    104 
    105         },
    106 
    107         ajaxSubmit: function (submitUrl) {
    108             var self = this;
    109 
    110             $.ajax({
    111                 url: submitUrl,
    112                 data: {isAjax: 1},
    113                 type: 'post',
    114                 dataType: 'json',
    115                 beforeSend: function () {
    116                     $('.ln_overlay').show();
    117                     if (typeof window.history.pushState === 'function') {
    118                         window.history.pushState({url: submitUrl}, '', submitUrl);
    119                     }
    120                 },
    121                 success: function (res) {
    122                     if (res.backUrl) {
    123                         window.location = res.backUrl;
    124                         return;
    125                     }
    126                     if (res.navigation) {
    127                         $(self.options.navigationSelector).replaceWith(res.navigation);
    128                         $(self.options.navigationSelector).trigger('contentUpdated');
    129                     }
    130                     if (res.products) {
    131                         $(self.options.productsListSelector).replaceWith(res.products);
    132                         $(self.options.productsListSelector).trigger('contentUpdated');
    133                     }
    134                     $('.ln_overlay').hide();
    135                 },
    136                 error: function () {
    137                     window.location.reload();
    138                 }
    139             });
    140         }
    141     });
    142 
    143     return $.mageplaza.layer;
    144 });